package com.hxkj.domain.enums;

import com.platform.common.domain.exception.CustomExceptionCode;

/**
 * 单页异常枚举
 * <p>
 * created by zhuzhenxin on 2017/6/6.
 */
public enum LeafletExceptionEnum implements CustomExceptionCode {
    //异常枚举
    LEALFET_SAVE_ERRO(600, "新增单页错误", 900),
    LEALFET_ID_NULL(601, "单页ID为空", 900),
    LEALFET_HEADLINE_NULL(602, "标题为空", 900),
    LEALFET_SITEID_NULL(603, "站点id为空", 900),
    AUTHROLE_TEMPLATEID_NULL(604, "页面模版id为空", 900),
    AUTHROLE_ABSTRACTMSG_NULL(605, "摘要简介为空", 900),
    AUTHROLE_PARTICULARS_NULL(606, "详情为空", 900),
    LEALFET_MODIFY_ERRO(607, "单页编辑错误", 900),
    LEAFLETEXCEPTIONENUM(608, "单页删除错误", 900),
    LEALFET_GET_ERRO(609, "单页查询错误", 900),
    LEALFET_GETLIST_ERRO(610, "单页查询列表错误", 900),
    LEALFET_REPETITION(611, "单页标题重复", 900),
    LEALFET_CREATETIMESTRAT_NULL(612, "单页开始时间为空", 900),
    LEALFET_CREATETIMESEND_NULL(613, "单页结束时间为空", 900),
    LEALFET_MESSAGE_NULL(614, "请配置单页信息", 900),
    LEALFET_FREEMARKER_ERRO(615, "单页模板解析失敗", 900),
    LEALFET_RIGHT_ERRO(616, "请配置正确的模板!", 900),
    ;
    private Integer code;
    private String msg;
    private Integer httpCode;

    LeafletExceptionEnum(Integer code, String msg, Integer httpCode) {
        this.code = code;
        this.msg = msg;
        this.httpCode = httpCode;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public Integer getHttpCode() {
        return httpCode;
    }

    @Override
    public void setHttpCode(Integer httpCode) {
        this.httpCode = httpCode;
    }

    public static LeafletExceptionEnum getEnumByCode(Integer code){
        for(LeafletExceptionEnum leafletExceptionEnum : LeafletExceptionEnum.values()){
            if(code.equals(leafletExceptionEnum.getCode())){
                return leafletExceptionEnum;
            }
        }
        return null;
    }
}
